<script setup lang="ts">
import {RouterLink, RouterView, useRouter} from 'vue-router'
import {computed} from 'vue';
const route = useRouter();
let page = computed(() => route.currentRoute.value.matched[1].path)
</script>

<template>
  <div class="nav">
    <RouterLink to="/home">
      <img v-if="page=='/home'" src="../assets/imgs/logo.png" alt="">
      <img v-else src="../assets/imgs/home.png" alt="">
      首页
    </RouterLink>
    <RouterLink to="/movie">
      <img v-if="page==='/movie'" src="../assets/imgs/movie_active.png" alt="">
      <img v-else src="../assets/imgs/movie.png" alt="">
      电影/影院
    </RouterLink>
    <RouterLink to="/audio">
      <img v-if="page==='/audio'" src="../assets/imgs/audio_active.png" alt="">
      <img v-else src="../assets/imgs/audio.png" alt="">
      小视频</RouterLink>
    <RouterLink to="/play">
      <img v-if="page==='/play'" src="../assets/imgs/play_active.png" alt="">
      <img v-else src="../assets/imgs/play.png" alt="">
      演出/玩乐</RouterLink>
    <RouterLink to="/mine">
      <img v-if="page==='/mine'" src="../assets/imgs/mine_active.png" alt="">
      <img v-else src="../assets/imgs/mine.png" alt="">
      我的</RouterLink>
  </div>
  <RouterView />
</template>

<style lang="scss" scoped>
    .nav {
        position: fixed;
        display: flex;
        bottom: -2px;
        height: 50px;
        width: 100%;
        background-color: #fff;
        border-top: 1px solid #d8d8d8;
        z-index: 999;
        a {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            flex-direction: column;
            font-size: 12px;
            color: #696969;
            img {
                width: 25px;
                height: 25px;
                margin-bottom: 5px;
            }
            &.router-link-active {
                color: #f03d37;
            }
        }
    }
</style>